//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "ConnectionForm.h"
#include "Options.h"
#include "Access_class.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFConnect *FConnect;
//---------------------------------------------------------------------------
__fastcall TFConnect::TFConnect(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFConnect::Button1Click(TObject *Sender)
{
 if(OD->Execute())
  Edit1->Text = OD->FileName;
}
//---------------------------------------------------------------------------
void __fastcall TFConnect::BitBtn1Click(TObject *Sender)
{
 AccessProvider *AP = AccessProvider::Get();
 AP->AllOptions->Set("File", Edit1->Text);
 OD->InitialDir = ExtractFileDir(Application->ExeName);

}
//---------------------------------------------------------------------------
void __fastcall TFConnect::FormCreate(TObject *Sender)
{
 AccessProvider *AP = AccessProvider::Get();
 Edit1->Text = AP->AllOptions->Get("File");
 OD->InitialDir = ExtractFileDir(Application->ExeName);
 Disp = new TTabCtrl();
 Disp->Add(Edit1, NULL, BitBtn2, NULL, Button1, Button1, NULL);
 Disp->Add(Button1, NULL, BitBtn1, Edit1, NULL, BitBtn1, Edit1);
 Disp->Add(BitBtn2, Edit1, NULL, NULL, BitBtn1, BitBtn1, Button1);
 Disp->Add(BitBtn1, Button1, NULL, BitBtn2, NULL, NULL, BitBtn2);
}
//---------------------------------------------------------------------------
void __fastcall TFConnect::ApplicationEvents1Message(tagMSG &Msg,
      bool &Handled)
{
 Disp->Process(this, Msg, Handled);        
}
//---------------------------------------------------------------------------

void __fastcall TFConnect::FormClose(TObject *Sender, TCloseAction &Action)
{
 delete Disp;        
}
//---------------------------------------------------------------------------

